package com.umpay.privi.dao.on.sys.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.umpay.common.persist.AbstractDao;
import com.umpay.common.persist.ibatis.DataAccessException;
import com.umpay.common.persist.ibatis.exception.SQLErrorCodeSQLExceptionTranslator;
import com.umpay.privi.dao.EntityDaoImpl;
import com.umpay.privi.dao.on.sys.MenuDao;
import com.umpay.privi.model.sys.Menu;

/** 
 * desc:菜单Dao实现类
 * <p>创建人：Ding Zhe 创建日期：Apr 19, 2013 </p>
 * @version V1.0  
 */
@SuppressWarnings("unchecked")
public class MenuDaoImpl extends EntityDaoImpl<Menu> implements MenuDao {

	public Menu get(Integer menuId )throws DataAccessException{
		try {
			return (Menu)getSqlMapClientTemplate().getSqlMapClient().queryForObject("Menu.Get", menuId);
		} catch (SQLException e) {
			throw new SQLErrorCodeSQLExceptionTranslator(AbstractDao.DB_TYPE_DB2).translate(e.getMessage(), e);
		}
	}

	public List<Menu> findMenus(Map<String, Object> paraMap) throws DataAccessException {
		try {
			return getSqlMapClientTemplate().getSqlMapClient().queryForList("Menu.Find", paraMap);
		} catch (SQLException e) {
			throw new SQLErrorCodeSQLExceptionTranslator(AbstractDao.DB_TYPE_DB2).translate(e.getMessage(), e);
		}
	}
}



